<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/include/head.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript"
	src="<%=WEBPATH%>/dwr/interface/FhkhdAction.js?id=<%=generate%>"></script>
<title><html:text name="sys.name" /></title>
</head>
<body>
<form id="listDataForm" method="post"
	action="<%=WEBPATH%>/crm/fhkhd/index.crm">
<table  class="condition-table" >
<tr>
	<td colspan="4" class="x-panel-header" align="center"><html:text name="fhkhd" /><html:text name="entity.list" /></td>
</tr>
<tr>
	<td>&nbsp;<html:text name="fhkhd.lxr" /></td>
	<td>&nbsp;<html:textfield id="fhkhd.lxr" name="fhkhd.lxr" maxlength="40"></html:textfield></td>
	<td>&nbsp;<html:text name="fhkhd.state" /></td>
	<td>&nbsp;<html:select list="#{'':'','已提交':'已提交','已保存':'已保存'}" name="fhkhd.state" id="fhkhd.state"></html:select></td>
</tr>
<tr>
	<td>&nbsp;<html:text name="fhkhd.clientName" /></td>
	<td>&nbsp;<html:textfield id="fhkhd.clientName" name="fhkhd.clientName" maxlength="80"></html:textfield></td> 
	<td>&nbsp;<html:text name="fhkhd.fhDate" /></td>
	<td>&nbsp;<html:date id="birthDay" name="fhkhd.startDate" format="yyyy-MM-dd"/>
		<html:textfield dataType="date"   id="fhkhd.startDate" name="fhkhd.startDate" value="%{birthDay}" readonly="true"/>&nbsp;
		<img style="border:0px;" src="<%=WEBPATH%>/images/calendar.gif" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:'fhkhd.startDate'})">
		&nbsp;<html:text name="entity.to"/>&nbsp;<html:date id="birthDay2" name="fhkhd.endDate" format="yyyy-MM-dd"/>
		<html:textfield dataType="date"   id="fhkhd.endDate" name="fhkhd.endDate" value="%{birthDay2}" readonly="true"/>&nbsp;
		<img style="border:0px;" src="<%=WEBPATH%>/images/calendar.gif" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:'fhkhd.endDate'})">
	</td>
</tr>
<tr>
	
	<td align="right">&nbsp;</td>
	<td  colspan="3">
	<input type="submit" value="<html:text name="button.query"/>">&nbsp;&nbsp;
	<input type="button" id="new" name="new" onclick="javascript:newFunction();" value="<html:text name="button.new"/>">&nbsp;&nbsp;
	<input type="button" id="delete" name="delete" onclick="javascript:deleteFunction();" value="<html:text name="button.delete"/>">&nbsp;&nbsp;
	<input type="button" id="edit" name="edit" onclick="javascript:editFunction();" value="<html:text name="button.modify"/>">&nbsp;&nbsp;
	<input type="button" id="view" name="view" onclick="javascript:viewFunction();" value="<html:text name="button.view"/>">
	</td>
</tr> 
</table>
<script type="text/javascript">
	function newFunction(){
		window.location="<%=WEBPATH%>/crm/fhkhd/create.crm";
	}
	function deleteFunction(){
		if(checkSelectData()){
			var id=checkMultiSelectData();
			if(id==null||id=="0"){
				alert("<html:text name="entity.deleted.select"/>");
				return ;
			}
			if(confirm("<html:text name="entity.deleted.confirm"/>")){
				//alert(id);
				FhkhdAction.dwrDelete(id,callFunction);
			}
		}else{
			alert("<html:text name="entity.deleted.select"/>");
		}
		
	}
	function callFunction(data){
		if(data=="success"){
			alert("<html:text name="entity.deleted"/>");
			_$("listDataForm").submit();
		}else{ 
			alert("<html:text name="entity.deleted.error"/>");
		}
	}
	function editFunction(){
		if(checkSelectData()){
			var id=checkBooleanSelectData();
			if(id==null){
				alert("<html:text name="entity.updated.select"/>");
				return ;
			}
			window.location="<%=WEBPATH%>/crm/fhkhd/edit.crm?id="+id;
		}else{
			alert("<html:text name="entity.updated.select"/>");
		}
	}
	function viewFunction(){
		if(checkSelectData()){
			var id=checkBooleanSelectData();
			if(id==null){
				alert("<html:text name="entity.view.select"/>");
				return ;
			}
			window.location="<%=WEBPATH%>/crm/fhkhd/view.crm?id="+id;
		}else{
			alert("<html:text name="entity.view.select"/>");
		} 
	}
	function imgOnclick(orderBy,asc){
		jQuery("#orderBy").val(orderBy);
		jQuery("#asc").val(asc);
		_$("listDataForm").submit();
	}
</script>

<table class="datatable"> 
		<thead>
		<tr>
			<td align="left" width="80"><input type="checkbox" id="checkList" onclick="javascript:onSelectChange(this);"><html:text
				name="entity.choose" /><html:hidden
			id="asc" name="asc" /><html:hidden
			id="orderBy" name="orderBy" /></td>
			<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('clientName',false);"</html:if><html:else> onclick="javascript:imgOnclick('clientName',true);" </html:else>><html:text name="fhkhd.clientName" /><html:if test="orderBy=='clientName'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
			<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('fhDate',false);"</html:if><html:else> onclick="javascript:imgOnclick('fhDate',true);" </html:else>><html:text name="fhkhd.fhDate" /><html:if test="orderBy=='fhDate'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
			<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('fhr',false);"</html:if><html:else> onclick="javascript:imgOnclick('fhr',true);" </html:else>><html:text name="fhkhd.fhr" /><html:if test="orderBy=='fhr'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
			<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('state',false);"</html:if><html:else> onclick="javascript:imgOnclick('state',true);" </html:else>><html:text name="fhkhd.state" /><html:if test="orderBy=='state'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
			<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('lxr',false);"</html:if><html:else> onclick="javascript:imgOnclick('lxr',true);" </html:else>><html:text name="fhkhd.lxr" /><html:if test="orderBy=='lxr'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
			<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('lxdh',false);"</html:if><html:else> onclick="javascript:imgOnclick('lxdh',true);" </html:else>><html:text name="fhkhd.lxdh" /><html:if test="orderBy=='lxdh'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
			<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('address',false);"</html:if><html:else> onclick="javascript:imgOnclick('address',true);" </html:else>><html:text name="fhkhd.address" /><html:if test="orderBy=='address'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
			<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('skje',false);"</html:if><html:else> onclick="javascript:imgOnclick('skje',true);" </html:else>><html:text name="fhkhd.skje" /><html:if test="orderBy=='skje'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		</tr> 
		</thead>
	<html:if test="pages.result==null">
		<tbody>
			<tr>
				<td colspan="9"><html:text name="global.page.emptyMsg" /></td>
			</tr>
		</tbody>
		<script type="text/javascript">
			jQuery("#delete").hide();
			jQuery("#edit").hide();
			jQuery("#view").hide(); 
		</script>
	</html:if>
	<html:else>
		<html:iterator id="users" value="pages.result"
			status="index">
			<tbody>
				<tr <html:if test="#index.odd">class="row_odd"</html:if>
					<html:else>class="row_even"</html:else>>
					<td align="left"><input type="checkbox" id="selectCheck" name="selectCheck"
						value="<html:property value="id"/>"></input></td>
					<td align="left"><html:property value="clientName" /></td>
					<td align="left"><html:text name="global.format.date"><html:param value="fhDate"/></html:text></td>
					<td align="left"><html:property value="fhr" /></td>
					<td align="left"><html:property value="state" /></td>					
					<td align="left"><html:property value="lxr" /></td>
					<td align="left"><html:property value="lxdh" /></td>
					<td align="left"><html:property value="address" /></td>
					<td align="left"><html:text name="global.format.money"><html:param value="skje"/></html:text></td>
				</tr>
			</tbody>
		</html:iterator> 
		<tfoot>
		<tr>
			<td colspan="9" align="right" valign="middle">
			<script type="text/javascript"> 
				messages=new Array();
				messages[0]="<html:text name="global.page.first" />";
				messages[1]="<html:text name="global.page.prev" />";
				messages[2]="<html:text name="global.page.next" />";
				messages[3]="<html:text name="global.page.last" />";
				messages[4]="<html:text name="global.page.page" />";
				messages[5]="<html:text name="global.page.everyPage" />";
				messages[6]="<html:text name="global.page.total" />";
				messages[7]="<html:text name="global.page.record" />";
				messages[8]="<html:text name="global.page.primo" />";
				writePage(messages,"<%=WEBPATH%>","<html:property value="page"/>","<html:property value="pages.totalPages"/>","<html:property value="pageSize"/>");
			</script>
			</td>
		</tr></tfoot>
	</html:else>
</table>
</form>
</body>
</html>